# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=gc
pkgver=8.2.4
pkgrel=1
pkgdesc="garbage collector for C and C++"
url="https://hboehm.info/gc/"
arch="all"
license="Boehm-GC"
makedepends="linux-headers"
subpackages="$pkgname-dbg $pkgname-dev $pkgname-doc libgc++:libgccpp"
source="https://github.com/ivmai/bdwgc/releases/download/v$pkgver/gc-$pkgver.tar.gz"

case "$CARCH" in
ppc64le)
	# FIXME
	options="!check"
	;;
esac

build() {
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--datadir=/usr/share/doc/gc \
		--enable-static \
		--enable-cplusplus
	make
}

check() {
	make check
}

package() {
	make DESTDIR="$pkgdir" install
	install -Dm644 README.md "$pkgdir/usr/share/licenses/$pkgname/README.md"
}

libgccpp() {
	install -d "$subpkgdir"/usr/lib
	mv "$pkgdir"/usr/lib/libgccpp.* "$subpkgdir"/usr/lib/
}

sha512sums="
27d014378000f25fb2f5598904be85604822d5ed4553f8b3d1c279122300d3958b4432ec08f951cfd842d92121ea8a030dda34bf2475ec53d4fded551fdd3a98  gc-8.2.4.tar.gz
"
